﻿using System.ComponentModel.DataAnnotations;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NQueries.Utils;

namespace NQueries.Data.Test
{
    [TestClass]
    public class PropertyInfoExtensionsTest
    {
        public TestContext TestContext { get; set; }

        [TestMethod]
        public void IsPrimaryKeyTest() { Assert.IsTrue(typeof(Test).GetProperty("Id").IsPrimaryKey()); }

        [TestMethod]
        public void IsPrimaryKeyFailedTest() { Assert.IsFalse(typeof(Test).GetProperty("NotId").IsPrimaryKey()); }

        #region Nested type: Test

        public class Test
        {
            [Key]
            public int Id { get; set; }

            public int NotId { get; set; }
        }

        #endregion
    }
}